home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
TCL1
/
__MANDEL
/
MANDELBR
/
CMANDELR.C
< prev
next >
Wrap
Text File
|
1992-03-28
|
2KB
|
104 lines
// CMandelRectPhase.c
#include "CMandelRectPhase.h"
extern long gTickLimit;
void
CMandelRectPhase::IMandelRectPhase(CMandelDoc *theDoc, CMandelPhase *theNextPhase,
short theH, short theV, short theNCols, short theNRows)
{
CMandelPhase::IMandelPhase(theDoc, theNextPhase);
itsScale = theDoc->itsScale;
itsHStart = theDoc->itsHStart + (double)theH * itsScale;
itsVStart = theDoc->itsVStart - (double)theV * itsScale;
itsMaxDwell = theDoc->itsMaxDwell;
itsDwellsH = theDoc->itsDwellsH;
itsVOffset = (((long)theDoc->itsWidth - 1) - theNCols) * sizeof(TDwell);
itsNRows = theNRows;
itsNCols = theNCols;
itsIndex = ((long)theV * theDoc->itsWidth + theH) * sizeof(TDwell);
itsHTemp = itsHStart;
itsNTemp = itsNCols;
}
CMandelPhase *
CMandelRectPhase::Perform(void)
{
asm
{
movem.l d3-d7/a3,-(sp)
fmovem fp4-fp7,-(sp)
move.l (this),a3
fmove.x CMandelRectPhase.itsScale(a3),fp0
fmove.x CMandelRectPhase.itsVStart(a3),fp7
move.w CMandelRectPhase.itsVOffset(a3),d3
move.w CMandelRectPhase.itsNCols(a3),d4
move.w CMandelRectPhase.itsMaxDwell(a3),d5
move.w CMandelRectPhase.itsNRows(a3),d7
move.l CMandelRectPhase.itsDwellsH(a3),a1
move.l (a1),a0
adda.l CMandelRectPhase.itsIndex(a3),a0
fmove.x CMandelRectPhase.itsHTemp(a3),fp6
move.w CMandelRectPhase.itsNTemp(a3),d6
bra @0
@s:
fmove.x CMandelRectPhase.itsHStart(a3),fp6
move.w d4,d6
@0:
move.l Ticks,d0
cmp.l gTickLimit,d0
bgt @4
move.w d5,d0
fmove.x fp6,fp2 ; Z.a = Z0.a
fmove.x fp7,fp5 ; Z.b = Z0.b
bra @2
@1:
fsub.x fp3,fp2
fmul.x fp4,fp5
fscale.x #1.0,fp5
fadd.x fp6,fp2 ; ZZ.a += Z0.a
fadd.x fp7,fp5 ; ZZ.b += Z0.b
@2:
fmove.x fp2,fp4 ; Z = ZZ
fmul.x fp4,fp2 ; temp = ZZ.a * ZZ.a + ZZ.b * ZZ.b
fmove.x fp5,fp3
fmul.x fp5,fp3
fmove.x fp2,fp1
fadd.x fp3,fp1
fcmp.x #4.0,fp1
fbgt @3
dbra d0,@1
@3:
move.w d0,(a0)+
fadd.x fp0,fp6
dbra d6,@0
fsub.x fp0,fp7
adda.w d3,a0
dbra d7,@s
move.l CMandelRectPhase.itsNextPhase(a3),d0
bra @5
@4:
fmove.x fp6,CMandelRectPhase.itsHTemp(a3)
fmove.x fp7,CMandelRectPhase.itsVStart(a3)
move.w d6,CMandelRectPhase.itsNTemp(a3)
move.w d7,CMandelRectPhase.itsNRows(a3)
suba.l (a1),a0
move.l a0,CMandelRectPhase.itsIndex(a3)
clr.l d0
@5:
fmovem (sp)+,fp4-fp7
movem.l (sp)+,d3-d7/a3
}
}